void
shell_draw_app_highlight (ClutterCairoTexture *texture,
- gboolean multi,
+ int num_windows,
double red,
double green,
double blue,
cairo_t *cr;
guint width, height;
+ g_return_if_fail (num_windows > 0);
+
clutter_cairo_texture_get_surface_size (texture, &width, &height);
clutter_cairo_texture_clear (texture);
cairo_save (cr);
cairo_translate (cr, width / 2.0, height / 2.0);
- if (multi)
+ if (num_windows == 1)
{
- double scale;
+ cairo_scale (cr, width / 2.0, height / 2.0);
+ draw_glow (cr, red, green, blue, alpha);
+ }
+ else
+ {
+ int num_circles;
+ double scale, highlight_width;
+
+ num_circles = num_windows == 2 ? 2 : 3;
- /* We draw three circles of radius 1, at 0.0, -1.8, and +1.8.
- * Total width is therefore 1 + 1.8 + 1.8 + 1 = 5.6.
+ /* The circles will have radius 1.0 (diameter 2.0) and overlap
+ * by 0.2, so the total width of the highlight is:
*/
- scale = MIN (height / 2.0, width / 5.6);
- cairo_scale (cr, scale, scale);
+ highlight_width = 2.0 * num_circles - 0.2 * (num_circles - 1);
- draw_glow (cr, red, green, blue, alpha);
+ scale = MIN (height / 2.0, width / highlight_width);
+ cairo_scale (cr, scale, scale);
- cairo_translate (cr, -1.8, 0.0);
+ /* Leftmost circle first; its left side is at
+ * -highlight_width/2, so its center is that plus 1.
+ */
+ cairo_translate (cr, -highlight_width / 2.0 + 1.0, 0.0);
draw_glow (cr, red, green, blue, alpha);
- cairo_translate (cr, 3.6, 0.0);
- draw_glow (cr, red, green, blue, alpha);
- }
- else
- {
- cairo_scale (cr, width / 2.0, height / 2.0);
- draw_glow (cr, red, green, blue, alpha);
+ /* Remaining circles */
+ while (--num_circles)
+ {
+ cairo_translate (cr, 1.8, 0.0);
+ draw_glow (cr, red, green, blue, alpha);
+ }
}
cairo_restore (cr);